{% extends "layouts/baseview-nav.html" %}
{% load i18n %}
{% load short_uri %}

{%block title%}all projects{%endblock%}

{% block extrascript %}
<link rel="stylesheet" href="/css/new_open.css" />
<script type="text/javascript">
function watch_project(o,projname) {
q_get('prj/watch/' + projname, {}, function(r){
$(o).text(r[0]);
$('#watch_text').text(r[1]);
});
}
</script>
{% endblock %}

{%block main-nav%}
{%endblock%}
{%block body-menu%}
<!--
<div class="pagination">
      {%for m in bodymenus%}
	   <a class="pg-page pg-item" href="{{m.uri}}" data-page="{{m.text}}" > {{m.text}} </a>
      {%endfor%}
</div>
-->
{%endblock%}

{%block main-block%}
{%if all_projects%}
<div class="body-menu">
  <div class="left">
    <form id="prj-search-form" action="/all/" method="POST">
      {%csrf_token%}
      <input id="q" name="q" type="hidden" value="{{key_text}}"></input>
    </form>
    <input size="30" id="key-text" type="text" value="{{key_text}}"></input>
    <a id="btn-search" href="javascript:;" class="button">search</a>
  </div>
  <div class="img-btn right">
    <a href="/new" title="New project">
      <img src="/img/add_project.png"></img>
    </a>
  </div>
</div>
<!--
<div class="bottom-line">
  {% include "layouts/page-nav.html" %}
</div>
-->
{%endif%}
<p>
<div class="d-g-wrapper d-p-newopen">
  <table>    
   <tbody>
    {%for project in prjs%}
    <tr class>
    {%include "project/prj-info.html" with project=project%}
    <td> 
    {% if project.owner != user%}
                
                	{% if project.my_status == 3 or project.my_status == 0 %}
                	
					<a class="d-p-project-praise p-p-project-btn"  href= "javascript:void(0)" onclick="watch_project(this,'{{project.name}}');">
					{{project.watcher_count|default:0}} 
					
					</a>	
					{% endif %}
					
				{%endif%}
     
    </tr class>
   
    <!-- 
	<img src="/img/users.png" title="members"></img>
	<em>{{project.member_count|default:0}}</em>
	<img src="/img/watch.png" title="watchers"></img>
	<em id="watchers">{{project.watcher_count|default:0}}</em>
      </td>
    </tr>  -->
    {%endfor%}
  </table>
 </div>
</p>
<!--
{%if all_projects%}
<div class="pagination">
  {% include "layouts/page-nav.html" %}
</div>
{%endif%}

{%if prjs%}
<div class="pagination">
  {% include "layouts/page-nav.html" %}
</div>
{%endif%}
-->

<script>
	KISSY.use('js/app/main/new_open');
</script>
{%endblock%}
